FROM node:18-slim
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# RUN corepack enable && corepack prepare pnpm@9.12.3 --activate
RUN corepack enable

# FROM base AS build
COPY . /app
WORKDIR /app
# RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install 
RUN pnpm install
RUN pnpm build:currency-broker


# 使用Nginx作为服务器
# FROM nginx:alpine AS currency-broker
FROM nginx:alpine 
# 将dist文件夹下的文件复制到Nginx static文件夹下
COPY --from=0 /app/dist/currency-broker /usr/share/nginx/html

